package day05;
import java.util.Arrays;
import java.util.Scanner;
public class ArrayTest {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("输入你需要多大的数组：");
        int n= scan.nextInt();
        System.out.println("输入数组的范围（0-max）：");
        int max= scan.nextInt();
        int[] b = a(n,max);
        for(int i = 0;i<b.length;i++ ){
            System.out.println(b[i]);
        }
        System.out.println("----------------");
        int[] c= Arrays.copyOf(b,n+1);
        for (int i = 0;i<c.length;i++){
            System.out.println(c[i]);
        }

    }
    public static int[] a(int n,int max){
        int[] a=new int[n];
        for (int i=0;i<n;i++){
            a[i]=(int)(Math.random()*(max+1));

        }
        return a;
    }
}
